vm_event: synchronize vCPU state in vm_event_resume()
authorRazvan Cojocaru <rcojocaru@bitdefender.com>
Fri, 12 Aug 2016 14:51:36 +0000 (16:51 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 12 Aug 2016 14:51:36 +0000 (16:51 +0200)
commitcbfe4db8d750f3efdd11d482934b1cbfbe4284e6
tree039102db55e19a31065da0f268db3953461fc393
parente567d6942544585d8ca1eeec16a5c63c956e5dbc
vm_event: synchronize vCPU state in vm_event_resume()

Vm_event_vcpu_pause() needs to use vcpu_pause_nosync() in order
for the current vCPU to not get stuck. A consequence of this is
that the custom vm_event response handlers will not always see
the real vCPU state in v->arch.user_regs. This patch makes sure
that the state is always synchronized in vm_event_resume, before
any handlers have been called. This problem especially affects
vm_event_set_registers().

Simply checking vm_event_pause_count to make sure the vCPU is
paused suffices since there's only one ring / consumer at a
time, and events are being processed one-by-one, so the
toolstack won't unpause the vCPU behind our backs.

Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
xen/common/vm_event.c